package org.TCC_NOVO.client.modelo;

import com.google.gwt.user.client.rpc.IsSerializable;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@NamedQueries(
{
    @NamedQuery(name="usuario.login", query="select u from Usuario as u where u.nick = :nick and u.senha = :senha"),
    @NamedQuery(name="usuario.peloNick", query="select u from Usuario as u where u.nick = :nick")
})

@Entity
@Table(name="USUARIO")
public class Usuario implements Serializable, IsSerializable{

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="ID")
    private long id = 0;

    @ManyToOne()
    @JoinColumn(name="IDF_PAPEL")
    private Papel papel;

    @Column(name="NOME", length=80)
    private String nome = "";

    @Column(name="NICK", length=30, nullable=false)
    private String nick = "";

    @Column(name="SENHA", length=25)
    private String senha = "";
    
    @Column(name="EMAIL", length=50)
    private String email = "";

    public Usuario(){  }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public void setId(long ID) {
        this.id = ID;
    }

    public long getId() {
        return id;
    }
    
    public void setNick(String nick) {
        this.nick = nick;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    
    public String getEmail() {
        return email;
    }

    public String getSenha() {
        return senha;
    }
 
    public String getNick() {
        return nick;
    }
    
    public String getNome() {
        return nome;
    }

    public Papel getPapel() {
        return papel;
    }

    public void setPapel(Papel papel) {
        this.papel = papel;
    }   
}
